<template>
  <div class="container" :style="{paddingBottom: proLists.length?50+'px':0}">
    <div class="cart-header">
      <h3>购物车</h3>
      <div @click="back" class="header-left">
        <p>返回</p>
      </div>
      <div class="header-right" @click="editCart()" v-if="Object.keys(proLists).length">
        <p>{{editShow?'完成':'编辑'}}</p>
      </div>
    </div>
    <div class="cart-empty flex-box" v-show="!cartNum">
      <div class="flex-box">
        <img src="@/assets/img/cart-a001.png" alt="">
        <p>购物车是空的<span @click="toIndex">去逛逛</span></p>
      </div>
    </div>
    <div class="cart-lists" v-if="delProLists('cart').length">
      <dl v-for="(items,indexs) in delProLists('cart')" :key="indexs">
        <dt class="flex-box" v-if="items.couponId!='0'">
          <div class="left flex-box"><h6>促销</h6><h5>{{items.name}}</h5></div>
          <div class="right" v-if="Number(items.reduce)>0 && !editShow"><span>减</span>&nbsp;<i>￥</i>{{items.reduce}}</div>
        </dt>
        <dd v-for="(item,index) in items.details" :key="index">
          <div class="check-box flex-box">
            <input v-show="!editShow" class="icon iconfont-gb" ref="checkBtn" :checked="hasSelected(item)" name="checkCart" @click="selectGoods($event,item)" type="checkbox"/>
            <input v-show="editShow" class="icon iconfont-gb" ref="delBtn" @click="selectDelete($event,item)" type="checkbox"/>
          </div>
          <div class="pro-img flex-box">
            <router-link :to="{ name: 'productdetail', params: { id: item.allbusinessId ,formtype:3} }"><img :src="$BASEPATH + item.img"></router-link>
          </div>
          <div class="desc-box">
            <h3 class="title">{{item.name | resize(15)}}</h3>
            <!-- <p class="discribe">{{item.describe| resize(18)}}</p> -->
            <p class="price"><span>￥</span>{{item.price}}</p>
          </div>
          <div class="pro-num" v-show="!editShow">
            <button class="left flex-box" :class="{active:item.amount<=1}" :disabled="item.amount<=1 || item.amountFlag !=='1'" @click="proMinus(item)">
              <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-gb-jian"></use>
            </svg></button>
            <div class="center flex-box">{{item.amount}}</div>
            <button class="right flex-box" @click="proAdd(item)" :disabled="item.amountFlag !=='1'"><svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-gb-jia"></use>
            </svg></button>
          </div>
          <div class="cuxiao-box flex-box" v-if="item.ecCoupons && !editShow">
            <div class="cuxiao-box-left flex-box">
              <p class="huodong-icon">商品活动</p>
              <p class="huodong-desc">{{item | capitalize}}</p>
            </div>
            <button class="huodong-check" @click="showCuXiaoBox(item)">选择促销
              <svg class="icon" aria-hidden="true">
                <use xlink:href="#icon-gb-arrow-right"></use>
              </svg>
            </button>
          </div>
        </dd>
      </dl>
    </div>
    <div class="cart-tuijian">
      <div class="tuijian-header">
        <h3>为你推荐</h3>
        <p>买了以上的人还买了</p>
      </div>
      <ul class="flex-box">
        <li v-for="(item,index) in recommend" :key="index">
          <div class="img-box">
            <img :src="require('@/assets/img/' + item.img)" alt="">
          </div>
          <div class="content-box">
            <h3>{{item.name | resize(10)}}</h3>
            <p>{{item.describe | resize(12)}}</p>
            <h4><span>￥</span>{{item.priceN}}<i v-if="item.priceP">￥{{item.priceP}}</i></h4>
            <!-- <div class="add-to-cart flex-box" :class="{'cart-active':activeView === index}" @click="addToCart(item, index)">
              <i class="icon iconfont-gb icon-gb-gouwuche"></i>
            </div> -->
          </div>
        </li>
      </ul>
    </div>
    <div class="cart-footer" :class="{'staff':isStaff}" v-if="cartNum">
      <div class="count-box flex-box" v-show="!editShow">
        <div class="select-all flex-box">
          <input class="icon iconfont-gb" 
            :checked="Object.keys(proLists).length===Object.keys(selectedLists).length" 
            ref="checkAllBtn" 
            @click="selectAll($event,proLists)" 
            type="checkbox"
            />
          <p>全选</p>
        </div>
        <div class="select-pay"><p>合计：<span>￥</span><i>{{(cartsMoney-reduceAll).toFixed(2)}}</i></p><h6 v-if="reduceAll>0">已节省：￥{{reduceAll}}</h6></div>
        <div class="check-now flex-box"><button :disabled="!selectedCartNum" @click="toPayment"> 结算{{selectedNum>0?'('+selectedNum+')':''}}</button> </div>
      </div>
      <div class="count-box delete-box flex-box" v-show="editShow">
        <div class="select-all flex-box"><input class="icon iconfont-gb" ref="deleteAllBtn" @click="deleteAll($event,proLists)" type="checkbox"/><p>全选</p></div>
        <div class="delete-now flex-box" @click="deleteItems">删除</div>
      </div>
    </div>
    <transition mode="out-in"
      name="slide-right"
      :enter-active-class="'slide-active'"
      :leave-active-class="'slide-active'">
      <cuXiaoBox v-show="showCuXiao" :showCuXiao="showCuXiao" :cuxiaoData = "cuxiaoData"></cuXiaoBox>
    </transition>
  </div>
</template>

<script>
// @ is an alias to /src
// import qs from 'qs'
import cuXiaoBox from '@/components/Cart/CuXiao.vue'
import { mapGetters, mapActions, mapState } from 'vuex'
export default {
  name: 'mallIndex',
  data() {
    return {
      lists: [1, 2, 3, 4],
      editShow: false,
      selectedGoods: [],
      priceTotle: '',
      deleteLists: {},
      cuxiaoData: '',
      recommend: '',
      showCuXiao: false,
      activeView: ''
    }
  },
  components: {
    cuXiaoBox
  },
  watch: {
    // 计算所选产品价格总和
    // proLists: {
    //   handler: function(data) {
    //     var s = 0
    //     data.forEach(item => {
    //       if (item.checked) {
    //         s += item.priceN
    //       }
    //     })
    //     this.priceTotle = s
    //   },
    //   deep: true //对象内部的属性监听，也叫深度监听
    // }
  },
  props: ['isStaff'],
  computed: {
    ...mapState({
      logState: state => state.global.isLogIn,
      proLists: state => state.cart.cart,
      selectedLists: state => state.cart.cartSelected
    }),
    ...mapGetters({
      hasSelected: 'cart/hasSelected',
      selectedCartNum: 'cart/selectedCartNum',
      cartNum: 'cart/cartNum',
      cartsMoney: 'cart/cartsMoney',
      hasGoods: 'cart/hasGoods',
      delProLists: 'cart/delProLists'
    }),
    cuxiaoName: function() {
      let name = '不使用促销'
      if (this.proLists.ecCoupons) {
        this.proLists.ecCoupons.forEach(item => {
          if (item.id === this.proLists.couponId) {
            name = item.name
          }
        })
      } else {
        name = '不使用促销'
      }
      return name
    },
    reduceAll: function() {
      let re = 0
      this.delProLists('cart').forEach(item => {
        re += Number(item.reduce) * 100
      })
      return (re / 100).toFixed(2)
    },
    selectedNum: function() {
      let num = 0
      Object.keys(this.selectedLists).forEach(key => {
        num += this.selectedLists[key].amount
      })
      return num
    }
  },
  filters: {
    resize: function(value, n) {
      if (!value) return ''
      value = value.toString()
      // return value.replace(/[\u0391-\uFFE5]/g, 'aa').length
      return value.length > n ? value.slice(0, n) + '...' : value
      // return value.charAt(0).toUpperCase() + value.slice(1)
    },
    capitalize: function(value) {
      if (!value.ecCoupons) return ''
      let name = '不使用促销'
      value.ecCoupons.forEach(item => {
        if (item.id === value.couponId) {
          name = item.name
        }
      })
      return name
    }
  },
  methods: {
    ...mapActions({
      clearCart: 'cart/clear_cart',
      createGoodsToCart: 'cart/create_goods_to_cart',
      createGoodsToSelected: 'cart/create_goods_to_selected',
      deleteGoodsFromCart: 'cart/delete_goods_from_cart',
      deleteGoodsFromSelected: 'cart/delete_goods_from_selected',
      reduceGoodsFromCart: 'cart/reduce_goods_from_cart',
      reduceGoodsFromSelected: 'cart/reduce_goods_from_selected',
      addGoodsFromCart: 'cart/add_goods_from_cart',
      addGoodsFromSelected: 'cart/add_goods_from_selected',
      modifyGoodsNumFromCart: 'cart/modify_goods_num_from_cart',
      updateGoodsCouponid: 'cart/update_goods_couponid'
    }),
    editCart() {
      this.editShow = !this.editShow
      this.showCuXiao = false
    },
    updateCart(goods, state) {
      let goodsAmount = goods.amount
      if (state === 'plus') {
        goodsAmount++
      } else if (state === 'minus') {
        goodsAmount--
      }
      let params = {
        cartId: goods.id,
        amount: goodsAmount,
        couponId: goods.couponId,
        selectStatus: goods.selectStatus
      }
      return this.$API.updateCart(params)
    },
    toIndex() {
      this.$router.push('/')
    },
    toPayment() {
      this.$router.push('/payment')
    },
    back() {
      if (this.editShow) {
        this.editShow = false
      } else if (this.showCuXiao) {
        this.showCuXiao = false
      } else {
        this.$router.go(-1)
      }
    },
    selectGoods($e, goods) {
      if ($e.target.checked) {
        goods.selectStatus = '1'
        this.updateCart(goods)
          .then(data => {
            if (data.flag) {
              this.$refs.checkAllBtn.checked = false
              this.createGoodsToSelected(goods)
            } else {
              return
            }
          })
          .catch(err => {
            alert(err)
          })
      } else {
        goods.selectStatus = '0'
        this.updateCart(goods)
          .then(data => {
            if (data.flag) {
              this.$refs.checkAllBtn.checked = false
              this.deleteGoodsFromSelected(goods)
            } else {
              return
            }
          })
          .catch(err => {
            alert(err)
          })
      }
    },
    selectAll($e, goods) {
      if ($e.target.checked) {
        this.$refs.checkBtn.forEach(item => {
          item.checked = true
        })
        Object.keys(goods).forEach(item => {
          console.log(item)
          goods[item].selectStatus = '1'
          this.updateCart(goods[item])
            .then(data => {
              if (data.flag) {
                this.createGoodsToSelected(goods[item])
              } else {
                return
              }
            })
            .catch(err => {
              alert(err)
            })
        })
      } else {
        this.$refs.checkBtn.forEach(item => {
          item.checked = false
        })
        Object.keys(goods).forEach(item => {
          console.log(item)
          goods[item].selectStatus = '0'
          this.updateCart(goods[item])
            .then(data => {
              if (data.flag) {
                this.deleteGoodsFromSelected(goods[item])
              } else {
                return
              }
            })
            .catch(err => {
              alert(err)
            })
        })
      }
    },
    selectDelete($e, goods) {
      this.$refs.deleteAllBtn.checked = false
      if ($e.target.checked) {
        this.deleteLists[goods.allbusinessId] = goods
        // console.log(this.deleteLists)
      } else {
        delete this.deleteLists[goods.allbusinessId]
        // console.log(this.deleteLists)
      }
    },
    // 选中所有购物车列表
    deleteAll($e, goods) {
      if ($e.target.checked) {
        this.$refs.delBtn.forEach(item => {
          item.checked = true
        })
        Object.keys(goods).forEach(item => {
          this.deleteLists[item] = goods[item]
        })
        // console.log(this.deleteLists)
      } else {
        this.$refs.delBtn.forEach(item => {
          item.checked = false
        })
        Object.keys(goods).forEach(item => {
          delete this.deleteLists[item]
        })
        // console.log(this.deleteLists)
      }
    },
    // 删除购物车
    deleteItems() {
      // console.log('test')
      console.log(this.deleteLists)
      let deleteItems = []
      Object.keys(this.deleteLists).forEach(item => {
        console.log(item)
        deleteItems.push(this.deleteLists[item].id)
      })
      // console.log(deleteItems.join())
      this.$API
        .deleteCart({ cartIds: deleteItems.join() })
        .then(data => {
          if (data.flag) {
            this.$API.getCart()
          } else {
            this.$layer.msg(data.msg)
          }
        })
        .catch(err => {
          alert(err)
        })
      // Object.keys(this.deleteLists).forEach(item => {
      //   this.deleteGoodsFromCart(this.deleteLists[item])
      //   this.deleteGoodsFromSelected(this.deleteLists[item])
      // })
    },
    proAdd(goods) {
      let selectedGoods = this.$store.state.cart.cartSelected
      this.updateCart(goods, 'plus')
        .then(data => {
          if (data.flag) {
            this.addGoodsFromCart(goods)
            // console.log(this.$store.state.cart)
            if (goods.allbusinessId in selectedGoods) {
              // console.log(true)
              this.addGoodsFromSelected(goods)
            } else {
              // console.log(false)
              return
            }
          } else {
            this.$layer.msg(data.msg)
            return
          }
        })
        .catch(err => {
          alert(err)
        })
    },
    proMinus(goods) {
      let selectedGoods = this.$store.state.cart.cartSelected
      this.updateCart(goods, 'minus')
        .then(data => {
          console.log(data)
          if (data.flag) {
            this.reduceGoodsFromCart(goods)
            if (goods.allbusinessId in selectedGoods) {
              // console.log(true)
              this.reduceGoodsFromSelected(goods)
            } else {
              console.log(false)
              return
            }
          } else {
            this.$layer.msg(data.msg)
            return
          }
        })
        .catch(err => {
          alert(err)
        })
    },
    showCuXiaoBox(data) {
      this.cuxiaoData = data
      setTimeout(() => {
        this.showCuXiao = true
      }, 10)
    }
  },
  created() {
    this.$API.getCart()
    this.$bus.$on('closeChuXiao', data => {
      this.showCuXiao = data
    })
    this.$bus.$on('selectChuXiaoId', goods => {
      this.updateCart(goods)
        .then(data => {
          // console.log(data)
          if (data.flag) {
            this.updateGoodsCouponid(goods)
            // console.log(this.$store.state)
            this.showCuXiao = false
          } else {
            this.$layer.msg(data.msg)
          }
        })
        .catch(err => {
          alert(err)
        })
    })
  },
  mounted() {
    console.log(this.proLists, this.selectedLists)
    this.$axios
      .get('../data/recommend.json')
      .then(data => {
        // console.log(data)
        this.recommend = data.data.result
      })
      .catch(err => {
        console.log(err)
      })
    console.log(this.delProLists('cart'))
  }
}
</script>

<style scoped lang="scss">
.container {
  width: 100%;
  height: 100%;
  background: #fff;
  overflow-y: auto;
  color: #333;
  padding-bottom: 50px;
  box-sizing: border-box;
  .cart-header {
    width: 100%;
    height: 48px;
    text-align: center;
    line-height: 48px;
    font-size: 16px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    background: #eee;
    &::after {
      width: 100%;
      border-bottom: 1px solid #f0f0f0;
      content: '';
      position: absolute;
      left: 0;
      bottom: 0;
      // transform: scaleY(0.5);
      // transform-origin: bottom left;
    }
    .header-right {
      right: 0;
      top: 0;
      width: 60px;
      background: #eee;
      position: absolute;
      height: 100%;
      font-size: 14px;
    }
    .header-left {
      left: 0;
      top: 0;
      width: 60px;
      background: #eee;
      position: absolute;
      height: 100%;
      font-size: 14px;
      p i {
        font-size: 14px;
        margin-right: 4px;
        position: relative;
        top: -2px;
      }
    }
  }
  .cart-lists {
    width: 100%;
    padding-top: 48px;
    overflow: hidden;
    background: #eee;
    dl {
      width: 100%;
      float: left;
      border-bottom: 8px solid #eee;
      dt {
        width: 100%;
        height: 48px;
        border-top-left-radius: 12px;
        border-top-right-radius: 12px;
        text-align: left;
        font-size: 14px;
        font-weight: bold;
        color: #000;
        background: #fff;
        padding: 0 10px;
        box-sizing: border-box;
        border-bottom: 1px solid #f6f6f6;
        justify-content: space-between;
        .right {
          font-size: 14px;
          color: rgb(255, 101, 101);
          font-weight: bold;
          span {
            font-weight: normal;
            display: inline-block;
            width: 18px;
            height: 18px;
            line-height: 18px;
            font-size: 12px;
            text-align: center;
            border-radius: 10px;
            box-sizing: border-box;
            border: 1px solid rgb(255, 101, 101);
          }
          i {
            font-size: 10px;
            position: relative;
            top: -3px;
            font-weight: normal;
          }
        }
        h6 {
          display: inline-block;
          border-radius: 4px;
          background: rgb(255, 101, 101);
          color: #fff;
          width: 38px;
          font-size: 12px;
          font-weight: normal;
          text-align: center;
          line-height: 19px;
          height: 18px;
          margin-right: 8px;
        }
        h5 {
          width: 210px;
          line-height: 24px;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
      }
      dd {
        width: 100%;
        float: left;
        padding-top: 15px;
        padding-bottom: 15px;
        background: #fff;
        position: relative;
        border-bottom: 1px solid #f6f6f6;
        &:last-child {
          border: none;
        }
        h3 {
          text-align: left;
          font-size: 14px;
          margin-top: 0;
          line-height: 16px;
          padding-right: 12px;
        }
        p {
          text-align: left;
          font-size: 12px;
          color: #aaa;
          margin-top: 6px;
        }
        p.price {
          font-size: 16px;
          color: #fe9402;
          position: absolute;
          left: 0;
          top: 38px;
          span {
            font-size: 10px;
            position: relative;
            top: -3px;
          }
          i {
            margin-left: 6px;
            font-size: 12px;
            color: #aaa;
            text-decoration: line-through;
          }
        }
        .check-box {
          width: 45px;
          height: 100%;
          float: left;
        }
        .desc-box {
          float: left;
          position: relative;
        }
        .pro-img {
          width: 60px;
          height: 60px;
          position: relative;
          float: left;
          overflow: hidden;
          background: #fff;
          margin-right: 12px;
          a {
            position: relative;
            z-index: 8;
          }
          img {
            width: 100%;
          }
          &::before {
            width: 120px;
            height: 120px;
            display: block;
            position: absolute;
            top: 0;
            left: 0;
            content: '';
            border-radius: 6px;
            border: 1px solid #ddd;
            box-sizing: border-box;
            transform: scale(0.5);
            transform-origin: top left;
          }
        }
        .pro-num {
          width: 168px;
          height: 56px;
          border-radius: 3px;
          position: absolute;
          top: 15px;
          right: 15px;
          transform: scale(0.4);
          transform-origin: bottom right;
          border: 1px solid #ddd;
          button {
            float: left;
            width: 56px;
            height: 100%;
            border: none;
            background: #fff;
            color: #666;
            box-sizing: border-box;
            &:disabled {
              color: #ccc;
            }
            svg {
              font-size: 28px;
            }
            &.active {
              color: #ccc;
            }
            &.left {
              border-right: 1px solid #ddd;
            }
            &.right {
              border-left: 1px solid #ddd;
            }
          }
          & > div {
            float: left;
            width: 54px;
            height: 100%;
            line-height: 24px;
            box-sizing: border-box;
            font-size: 28px;
            color: #666;
            &.center {
              font-size: 32px;
            }
          }
        }
        .cuxiao-box {
          width: 100%;
          float: left;
          padding: 14px 15px 0 45px;
          box-sizing: border-box;
          line-height: 14px;
          justify-content: space-between;
          -webkit-justify-content: space-between;
          .cuxiao-box-left {
            p.huodong-icon {
              font-size: 10px;
              color: #fe9402;
              padding: 2px 4px;
              display: inline-block;
              margin-top: 0;
              border: 1px solid #fe9402;
              border-radius: 2px;
              margin-right: 8px;
              box-sizing: border-box;
            }
            p.huodong-desc {
              display: inline-block;
              width: 165px;
              height: 16px;
              overflow: hidden;
              line-height: 16px;
              font-size: 14px;
              color: #333;
              margin-top: 0;
              white-space: nowrap;
              text-overflow: ellipsis;
            }
          }
          .huodong-check {
            border: none;
            outline: none;
            background: none;
            padding: 0;
            font-size: 14px;
            color: #fe9402;
          }
        }
      }
    }
  }
  .cart-empty {
    padding: 15px 0;
    padding-top: 63px;
    border-bottom: 8px solid #eee;
    img {
      width: 100px;
    }
    p {
      font-size: 14px;
      color: #666;
      margin-left: 8px;
      span {
        display: inline-block;
        padding: 2px 5px;
        color: #1c93d0;
        border: 1px solid #a9c8d8;
        border-radius: 3px;
        margin-left: 3px;
      }
    }
  }
  .cart-tuijian {
    width: 100%;
    padding-bottom: 50px;
    overflow: hidden;
    .tuijian-header {
      width: 100%;
      text-align: center;
      padding: 10px 0;
      position: relative;
      &::before {
        width: 32%;
        display: block;
        border-bottom: 1px solid #ccc;
        content: '';
        position: absolute;
        left: 0;
        top: 28px;
        transform: scaleY(0.5);
        transform-origin: bottom;
      }
      &::after {
        width: 32%;
        display: block;
        border-bottom: 1px solid #ccc;
        content: '';
        position: absolute;
        right: 0;
        top: 28px;
        transform: scaleY(0.5);
        transform-origin: bottom;
      }
      h3 {
        font-size: 16px;
        line-height: 22px;
        color: #1c93d0;
      }
      p {
        font-size: 12px;
        line-height: 18px;
        color: #999;
      }
    }
    ul {
      justify-content: space-between;
      flex-wrap: wrap;
      li {
        width: 49.3%;
        margin-bottom: 12px;
        img {
          width: 100%;
        }
        .content-box {
          width: 100%;
          height: 60px;
          padding: 5px 10px;
          box-sizing: border-box;
          text-align: left;
          position: relative;
          h3 {
            font-size: 14px;
            line-height: 16px;
            margin-bottom: 4px;
            margin-top: 2px;
          }
          p {
            font-size: 10px;
            color: #999;
          }
          h4 {
            font-size: 16px;
            color: #fe7c02;
            line-height: 16px;
            margin-top: 4px;
            span {
              font-size: 12px;
              position: relative;
              top: -3px;
            }
            i {
              font-size: 12px;
              color: #999;
              margin-left: 8px;
              text-decoration: line-through;
            }
          }
          .add-to-cart {
            width: 18px;
            height: 18px;
            border: 1px solid #ccc;
            position: absolute;
            right: 8px;
            border-radius: 18px;
            top: 32px;
            i {
              font-size: 12px;
              position: absolute;
              top: 4px;
            }
          }
          .cart-active {
            border: 1px solid rgb(238, 141, 96);
            i {
              color: #fe9402;
            }
          }
        }
      }
    }
  }
  .cart-footer {
    width: 100%;
    height: 48px;
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 8;
    background: #fff;
    font-size: 16px;
    border-top: 1px solid #f0f0f0;
    box-sizing: border-box;
    color: #333;
    &.staff {
      bottom: 57px;
      z-index: 9999999;
      border-bottom: 1px solid #f0f0f0;
    }
    .count-box {
      width: 100%;
      height: 100%;
      & > div {
        input {
          margin-top: 0;
          float: left;
          margin-right: 12px;
        }
        &.select-all {
          width: 24%;
        }
        &.select-pay {
          width: 46%;
          text-align: left;
          padding-left: 6px;
          box-sizing: border-box;
          p {
            span {
              font-size: 12px;
              position: relative;
              top: -3px;
              color: #fe9402;
            }
            i {
              color: #fe9402;
            }
          }
          h6 {
            font-size: 10px;
            color: #666;
            margin-top: 4px;
            line-height: 10px;
          }
        }
        &.check-now {
          width: 30%;
          height: 100%;
          button {
            width: 100%;
            height: 100%;
            color: #fff;
            border: none;
            font-size: 16px;
            outline: none;
            background: #fe9402;
            &:disabled {
              background: #ccc;
            }
          }
        }
      }
      &::before {
        width: 100%;
        border-top: 1px solid #ccc;
        position: absolute;
        left: 0;
        content: '';
        top: -1px;
        transform: scaleY(0.33);
        transform-origin: bottom;
      }
    }
    .delete-box {
      justify-content: space-between;
      .delete-now {
        width: 30%;
        height: 100%;
        color: #fff;
        background: #f00;
      }
    }
  }
  input[type='checkbox'] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    position: relative;
    width: 20px;
    height: 20px;
    margin-top: 18px;
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 20px;
    outline: none;
    cursor: pointer;
  }
  input[type='checkbox']:after {
    content: '\e60d';
    position: absolute;
    display: block;
    width: 100%;
    height: 100%;
    font-size: 10px;
    // box-sizing: border-box;
    // border: 1px solid #eb6a00;
    color: #fff;
    text-align: center;
    line-height: 20px;
    transition: all ease-in-out 300ms;
    border-radius: 20px;
    opacity: 0;
  }
  input[type='checkbox']:checked {
    background: #fe9402;
    border: 1px solid #fe7c02;
  }
  input[type='checkbox']:checked:after {
    box-sizing: border-box;
    border-radius: 20px;
    opacity: 1;
  }
}
.slide-active {
  transition: 0.3s cubic-bezier(0.55, 0, 0.1, 1);
  transition-property: opacity, transform;
}
.slide-right-leave-to,
.slide-right-enter {
  opacity: 0;
  transform: translate3d(30%, 0, 0);
}
</style>
